using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;

public partial class Admin_TrangThaiSPUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    private void LoadData()
    {
        try
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            tbTrangThaiSP dd = tbTrangThaiSPBUS.GetByID(id);
            if (dd != null)
            {
                txt_ma.Text = dd.IDTrangThaiSP.ToString();
                txt_tt.Text = dd.TrangThai.ToString();

            }
        }
        catch
        {
            Response.Redirect("~/Admin/TrangThaiSPList.aspx");
        }
    }
    protected void btcapnhat_ttsp_Click(object sender, EventArgs e)
    {
        tbTrangThaiSP dd = tbTrangThaiSPBUS.GetByID(int.Parse(txt_ma.Text));

        dd.TrangThai = txt_tt.Text;

        tbTrangThaiSPBUS.Update_TrangThaiSP (dd);

        Response.Redirect("~/Admin/TrangThaiSPList.aspx");
    }
}
